/*
******************
* author: 马丰彦
* date: 2019
* function: 管理cookie
******************
*/

/**
* @param { String } token 前后台的key
* @param { String } url 从BOSS登录端传来的url，以便于验权
*/
import Cookies from 'js-cookie'

const TokenKey = 'setting-token'
const UserName = 'userNameSetting'
const UserRole = 'userRoleSetting'
export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

const UrlKey = 'url'

export function getUrl() {
  return Cookies.get(UrlKey)
}

export function setUrl(url) {
  return Cookies.set(UrlKey, url)
}

export function removeUrl() {
  return Cookies.remove(UrlKey)
}

export function getUser() {
  return Cookies.get(UserName)
}

export function setUser(token) {
  return Cookies.set(UserName, token)
}

export function removeUser() {
  return Cookies.remove(UserName)
}

export function getRole() {
  return Cookies.get(UserRole)
}

export function setRole(token) {
  return Cookies.set(UserRole, token)
}

export function removeRole() {
  return Cookies.remove(UserRole)
}

